package com.gxc.controller;

import com.gxc.dto.Dept;
import com.gxc.feign.HystrixFeign;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author GongXincheng
 * @since 2019-08-22 09:18
 */
@RestController
@RequestMapping("/hystrix")
public class HystrixController {

    @Resource
    private HystrixFeign hystrixFeign;

    @GetMapping("/test")
    public String hello() {
        return hystrixFeign.hello();
    }

    @GetMapping("/dept/{id}")
    public Dept findById(@PathVariable Long id) {
        return hystrixFeign.findById(id);
    }

    @PostMapping("/dept")
    public Boolean add(@RequestBody Dept dept) {
        return hystrixFeign.add(dept);
    }

    @GetMapping("/dept/list")
    public List<Dept> list() {
        return hystrixFeign.list();
    }

    @GetMapping("/discovery")
    public Object discovery() {
        return hystrixFeign.discovery();
    }

}
